<template>
	<view>
		<view class="news" v-for="item in newsList" :key="item.id" @click="navigator(item.id)">
			<image src="/static/icon//news-active.png"></image>
			<view class="right">
				<view class="title">{{item.title}}</view>
				<view>
					<text>发表时间：{{item.add_time | formatDate}}</text>
					<text>浏览量：{{item.click}}</text>
				</view>
			</view>
		</view>
	</view>

</template>

<script>
	export default {
		props: ['newsList'],
		methods: {
			navigator(id) {
				this.$emit('itemClick', id)
			}
		}
	}
</script>

<style lang="scss">
	.news {
		display: flex;
		border-bottom: 1px solid $shop-color;
		box-sizing: border-box;
		padding: 10px 10px;

		image {
			text-align: center;
			max-width: 180rpx;
			height: 75px;
		}

		.right {
			width: 550rpx;
			padding-left: 20rpx;
			display: flex;
			flex-direction: column;
			justify-content: space-between;

			.title {
				font-size: 28rpx;
			}

			view {
				font-size: 26rpx;

				:nth-child(2) {
					margin-left: 40rpx;
				}
			}
		}
	}
</style>
